/*
 * Project: Daycare Web Application
 * Package: com.madetoordersoftware.daycare.control
 * File:    HomeCtrl
 * Created: Jun 3, 2010
 */
/**
 * Copyright (c) 2010 Made 2 Order Software, LLC
 *
 * All rights reserved. No part of this software may be reproduced, stored in a retrieval system, or
 * transmitted in any form or by any means, without the prior written permission of Made 2 Order Software.
 *
 * You may not distribute the URL or redistribute the files to third parties. You may transfer the files onto
 * a single storage device so long as you can prove ownership of the software. You may not reverse engineer,
 * decompile, or disassemble the software or media files. You may not modify or translate the software or
 * media, or distribute copies of the software or media without the written consent of Made 2 Order Software,
 * LLC.
 */
package com.made2ordersoftware.daycare.control;

import com.made2ordersoftware.control.AbstractCtrl;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Control class for home page navigations.
 *
 * @author David Canning <dcannin@gmail.com>
 * @version 1.0.0
 */
@Named("home")
@RequestScoped
public class HomeCtrl extends AbstractCtrl {

    private static final Logger LOG = LoggerFactory.getLogger(HomeCtrl.class);
    private static final long serialVersionUID = 1L;
    private boolean childSignedIn;
    @Inject private FormListCtrl listControl;

    /**
     * Creates an instance of <code>HomeCtr</code>.
     */
    public HomeCtrl() {
    }

    /**
     * Context class for home page of web site.
     *
     * @return String representing the home page.
     */
    public String mainMenu() {
        FacesContext.getCurrentInstance().renderResponse();
        return "/home";
    }

    /**
     * Returns true if there are any children currently logged into the day care system.
     *
     * @return
     */
    public boolean isChildSignedIn() {
        LOG.info("Inside isChildSignedIn");
        return !listControl.getChildrenSignedIn().isEmpty();
    }

}
